package acc_dao

import (
	"github.com/jinzhu/gorm"
	"time"
)

type Log struct {
	Id        int       `json:"id" gorm:"primary_key" description:"自增主键"`
	RoomId    int       `json:"room_id" gorm:"column:room_id" description:"聊天室Id"`
	UserId    int       `json:"user_id" gorm:"column:user_id" description:"用户ID"`
	Type      int       `json:"type" gorm:"column:type" description:"类型"`
	Content   string    `json:"content" gorm:"column:content" description:"内容`
	IsDelete  int       `json:"is_delete" gorm:"column:is_delete" description:"是否删除"`
	CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"`
}

func (l *Log) TableName() string {
	return "chat_room_log"
}

/**
 * @Author: yang
 * @Description：保存聊天记录
 * @Date: 2021/11/2 16:50
 */
func (l *Log) Save(tx *gorm.DB) (err error) {
	err = tx.Save(l).Error
	return
}
